package com.zg.scf.util;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zg.common.core.dao.scf.entity.Company;
import com.zg.common.core.dao.scf.entity.Credit;
import com.zg.common.core.util.DateUtil;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

/**
 * DESCRIPTION
 *
 * @author zhanfeng.liang
 * @since 2025-08-05
 */

public class ScfUtil {

    /**
     * 授信编号：企业信用代码后四位＋授信申请日＋序列号
     *  例：AM7U  250716 001
     * @return
     */
    public  static  String generateCode(String prefix,  int sequence){

        SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyMMdd");
        String currentDate = sdf.format(new java.util.Date());

        // 序列号格式化为3位数字，不足补0
        String sequenceStr = String.format("%03d", sequence);

        // 拼接生成授信编号
        return prefix + currentDate +sequenceStr;
    }
}
